Ext.define('Emp.controller.OperatorController', {
    extend: 'Emp.controller.BaseController',

    models: ['Operator'],
    views: ['operator.List', 'operator.Edit'],
    refs: [
        {ref: 'operatorList', selector: 'operatorlist'},
        {ref: 'operatorEdit', selector: 'operatoredit', xtype: 'operatoredit', autoCreate: true}
    ],
    
    init: function() {
        this.control({
        	'operatorlist grid': {
        		'itemdblclick': this.doModifyOnList
        	},
            'operatorlist gridtoolbar button[itemId=create]': {
                'click': this.doCreateOnList
            },
            'operatorlist gridtoolbar button[itemId=modify]': {
                'click': this.doModifyOnList
            },
            'operatorlist gridtoolbar button[itemId=read]': {
                'click': this.doReadOnList
            },
            'operatorlist gridtoolbar button[itemId=remove]': {
                'click': this.doRemoveOnList
            },
            'operatoredit': {
                'afterrender': this.doLoadOnEdit
            },
            'operatoredit button[action=save]': {
                'click': this.doSaveOnEdit
            },
            'operatoredit menuitem[action=save_close]': {
                'click': this.doSaveCloseOnEdit
            },
            'operatoredit button[action=create]': {
                'click': this.doCreateOnEdit
            },
            'operatoredit button[action=close]': {
                'click': this.doCloseOnEdit
            }            
        });
    }
});